﻿Imports System.Data
Imports System.Data.SqlClient
Imports System.IO
Public Class Registar_Visiatas_diarias_paciente

    Private Sub BntBuscar_Click(sender As Object, e As EventArgs) Handles BntBuscar.Click
        If TxtRut.Text = "" Then
            MsgBox("Llene el campo rut de la busqueda", MsgBoxStyle.Information, "Error")
        Else
            Sql.coner1.Close()
            Sql.coner1.Open()
            Dim adp6 As New SqlCommand("Buscar_Paciente2", Sql.coner1)
            adp6.CommandType = CommandType.StoredProcedure
            adp6.Parameters.AddWithValue("@Rut", TxtRut.Text)
            adp6.Parameters.AddWithValue("@Validar_Rut", TxtValidar.Text)
            adp6.Parameters.AddWithValue("@Fecha", Form1.ToolStripStatusLabel1.Text)
            adp6.Parameters.AddWithValue("@Fecha_Termino", " ")
            Dim ds6 As New DataSet()
            Dim dt6 As DataTable = New DataTable()
            Dim da6 As New SqlDataAdapter(adp6)
            da6.Fill(dt6)
            If dt6.Rows.Count > 0 Then
                TxtNombres.Text = dt6.Rows(0).Item(0)
                TxtApellidos.Text = dt6.Rows(0).Item(1)
                TxtDireccion.Text = dt6.Rows(0).Item(2)
                TxtSexo.Text = dt6.Rows(0).Item(3)
                TxtEdad.Text = dt6.Rows(0).Item(4)
                TxtFuncion.Text = dt6.Rows(0).Item(5)
                TxtCama.Text = dt6.Rows(0).Item(6)
                RichTextBox3.Text = dt6.Rows(0).Item(7)
            Else
                MsgBox("El Paciente no esta registrado", MsgBoxStyle.Information, "Registro")
            End If
        End If
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Me.Close()
    End Sub
End Class